< previous page page_196 next page >

Page 196
What about the Unicode conversion? It's automaticor rather, irrelevant. You see, when Visual Basic does an assignment between strings and arrays, it does not perform any conversion on the data. A string contains Unicode data internally, so when you transfer the Unicode data from the array to the string via an assignment, the data will be formatted correctly in the string.
There's just one catchyou can't copy an integer array into a string.
The solution is simple. Instead of declaring the StandardName and DisplayName fields as integers, we declare them as bytes and make sure that the arrays are the same size. In this case, the arrays are 64 bytes long, so the array declaration is
StandardName(63) As Byte
Once the array has been assigned to a string, you can search for the NULL terminator character (located at the end of every C language string) and truncate the string from that point.
You can see the correct results in Figure S15-1.
0196-01.gif
Figure S15-1:
The final TimeZone program screen
The complete program follows:
' Get Time Zone Information
' Copyright © 1998 by Desaware Inc. All Rights Reserved

Option Explicit

Private Type SYSTEMTIME

 
< previous page page_196 next page >